@extends('app')
@section('css')
@parent
	<link href="{{ asset('web/css/admin.css') }}" rel="stylesheet">
@stop
@section('content')
    <div class="page">
        <div class="header">“水榭香堤” 管理系统</div>
        <div class="row">
            <div class="col-md-12">
                @include('admin.left')
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            @include('_errors')
                            <table class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th width=2%>#</th>
                                    <th width=50%>用户名</th>
                                    <th width=18%>竞选</th>
                                    <th width=18%>权限</th>
                                    <th width=20%>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($users as $user)
                                    <tr>
                                        <th scope="row">{{ $user->id }}</th>
                                        <td>{{ $user->name }}</td>
                                        @if($vote = $user->votes()->first())
                                        <td><a href="{{ route('admin.votes.edit', [$vote->id]) }}">查看</a></td>
                                        @else
                                            <td>未参选</td>
                                        @endif
                                        <td>{{ App\Admin::$user_group[$user->is_admin] }}</td>
                                        <td>
                                            <a href="{{ url('admin/users/set_admin/'.$user->id) }}" data-method="POST" class="btn btn-default btn-xs">@if ($user->is_admin != 1)设为管理 @else 解除管理 @endif</a>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="pull-right">
                                {!! $users->render() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop